<template>
  <div class="container">
    <div class="title">
      <div>标题</div>
      <div @click="toggle">
        {{ isExpanded ? '收起' : '展开' }}
      </div>
    </div>
    <div :class="`content ${ isExpanded ? '' : 'hide' }`">
      aaaaaaaaaaa<br>
      aaaaaaaaaaa<br>
      aaaaaaaaaaa<br>
      aaaaaaaaaaa<br>
      aaaaaaaaaaa
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isExpanded: true,
    };
  },
  methods: {
    toggle () {
      this.isExpanded = !this.isExpanded;
    },
  },
}
</script>

<style scoped>
.container {
  width: 200px;
  outline: 1px solid red;
}
.title {
  border-bottom: 1px solid red;
  display: flex;
  justify-content: space-between;
}
.content {
  height: 120px;
  transition: height 1s ease;
  overflow: hidden;
}
.content.hide {
  height: 0;
}

</style>